package com.leoman.plz_p.utils;

import android.content.Context;

import com.tbruyelle.rxpermissions.RxPermissions;


/**
 * Created by guoh on 2017/2/28.
 */

public class PermissionsHelper {

    private String TAG="PermissionsHelper";

    private RxPermissions rxPermissions;

    public void requestLocation(Context activity){
//        RxJavaInterop.toV2Observable(RxView.clicks(findViewById(R.id.enableCamera))
//                .map(new Func1<Void, Object>() {
//                            @Override
//                            public Object call(final Void aVoid) {
//                                return new Object();
//                            }
//                        }))
//                .compose(rxPermissions.ensureEach(permission.CAMERA))
//                .subscribe(new Consumer<Permission>() {
//                               @Override
//                               public void accept(Permission permission) {
//                                   if (permission.granted) {
//
//                                   } else if (permission.shouldShowRequestPermissionRationale) {
//                                       // Denied permission without ask never again
//                                       Toast.makeText(activity,
//                                               "Denied permission without ask never again",
//                                               Toast.LENGTH_SHORT).show();
//                                   } else {
//                                       // Denied permission with ask never again
//                                       // Need to go to the settings
//                                       Toast.makeText(activity,
//                                               "Permission denied, can't enable the camera",
//                                               Toast.LENGTH_SHORT).show();
//                                   }
//                               }
//                           },
//                        new Consumer<Throwable>() {
//                            @Override
//                            public void accept(Throwable t) {
//                                Log.e(TAG, "onError", t);
//                            }
//                        },
//                        new Action() {
//                            @Override
//                            public void run() {
//                                Log.i(TAG, "OnComplete");
//                            }
//                        });
    }


}
